<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

use Illuminate\Support\Facades\Input;

Route::get('/', function () {
    return view('welcome');
});
Route::get('/admin/login', function () {
    return view('admin/entry/login');
});
Route::get('login', 'Admin\EntryController@loginForm');
Route::get('login2', 'Admin\EntryController@loginForm');
Route::get('/stu', function () {
    return view('stu/child');
});

Route::get('Come', 'WelcomeController@welcome');
Route::get('About', 'MyController@getAbout');
Route::get('Come2', function () {
    return view('admin.entry.login');
});
Route::post('Come3', function () {
    return 'post请求';
});
Route::any('Come4', 'WelcomeController@welcome');

Route::resource('user', 'UserController');

Route::get('index', 'MyController@index');
Route::get('indexone', 'MyController@indexone');
Route::get('indexforerch', 'MyController@indexforerch');
//Route::get('{number}',function ($number){
//    return view('home'.$number);
//});

Route::get('db', function () {
    $db = DB::connection()->getDatabaseName();
    echo $db;
});

Route::any('test2', function () {
    return Request::old(); //找回之前提交的历史表单记录
});
Route::any('test', function () {


//    会话
    Session::put('name', 'zhanghulll');
//    return Session::get('name');//返回指定键值的session
//    dd(Session::has('name'));//判断是否有这个键值
//    dd(Session::forget('name'));//删除键值
//    Session::pull('name');//取值出来之后，也把name删除了。


//    上传文件
//      dd(Request::file('profile')->getClientOriginalName());//取上传的文件名称
//      dd(Request::file('profile')->getClientOriginalExtension());//取后缀名

//    请求历史
//       return Request::flash();
//     return Request::flashOnly('name');//只保留name这个表单记录保存到old记录里面
//       return Request::flashExcept('name');//排除name这个表单记录，其他都保存在request::old()记录里面


//      dd(Request::except('name'));//排除name参数，其他都显示
//      dd(Request::only('name'));  //只显示name参数
//      dd(Request::fullUrl());//显示全都网址url http://zhanghu.io/test?age=29&name=zhangi
//    dd(Request::url());//显示http下面的网址不带参 http://zhanghu.io/test
//    dd(Request::getHost());//显示主机域名
    //return Input::get('name');
//     dd(Request::has('name'));//检查值是否存在
//      dd(Request::exists('name')); //检查是否存在键
//      return Request::all(); //打印所有数据
//      return Request::query('name');//打印所要的数据
//    $user = new App\User();
//    return $user->find(1);
//    $user->userAdd();
//    $user->updateUser();
//    $user->userDel();
//    return $user->testUser();
    //集合返回
//    $users = $user->all();
    //dd($users); //dd =>  var_dump(); and die();
//    return $users->toJson();

    //数组原型
//    $arr = ['one'=>1,'two'=>2,'three'=>3];
//    $collection = collect($arr);
    //return $collection -> all();
    //dd($collection);
    //$r = $collection->contains(one);//contains指的是值名
    //$r = $collection->has('one');//has指的是键名
    // return $r ? '有' : '没有';

//    $takes = $collection->take(2);//直接取前面几个值 ，正式前到后取，负数为后到前
//    return $takes;
});
Route::auth();

Route::get('/home', 'HomeController@index');

Route::get('form', function () {
    return view('form');
});

Route::any('yanzheng','TestController@create');

